﻿@{
    ViewBag.Title = "专题管理 - " + ViewBag.DomainTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<form class="layui-form query-form ptop15" id="queryToolBar">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户筛选</label>
            <div class="layui-input-inline">
                <input type="text" name="qMember" class="layui-input" placeholder="手机号码/名称/用户编号">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">专题名称</label>
            <div class="layui-input-inline">
                <input type="text" name="qName" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <span class="layui-btn layui-btn-sm" onclick="javascript: { tableReload();}">查询</span>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置查询条件</button>
        </div>
    </div>
</form>

<table class="layui-table" lay-filter="dataTable" lay-data="{id:'dataTable',height:'full-106',method:'post',cellMinWidth:120,page:true,limit:20,url:'/Special/AjaxData'}">
    <thead>
        <tr>
            <th lay-data="{field:'ID', fixed: 'left', width: 80}">ID</th>
            <th lay-data="{field:'CreateTime',width:170}">创建时间</th>
            <th lay-data="{field:'Phone', width: 150}">手机号码</th>
            <th lay-data="{field:'UserName', width: 120}">名称</th>
            <th lay-data="{field:'Number', width: 100}">用户编号</th>
            <th lay-data="{field:'Img', width: 60,templet:'#tmpImg'}">封面</th>
            <th lay-data="{field:'Name',width:240}">名称</th>
            <th lay-data="{field:'Content'}">内容</th>
            <th lay-data="{field:'ClickAmount',width:120}">点击量</th>
            <th lay-data="{field:'Remark'}">备注</th>
        </tr>
    </thead>
</table>

<script type="text/html" id="tmpImg">
    {{# if(d.Img) { }}
    <div id="col_img_{{ d.ID }}" onclick="javascript: { previewImg('col_img_{{ d.ID }}'); }">
        <img src="{{ fileApiUrl + d.Img }}" alt="图" />
    </div>
    {{# }else{ }}
    <span>无</span>
    {{# } }}
</script>

@Html.Partial("~/Views/Shared/_Script.cshtml")

<script>
    var table = layui.table, form = layui.form;
    // 刷新table
    function tableReload() {
        var paras = $('#queryToolBar').getForm();
        table.reload('dataTable', {
            where: paras
            , page: { curr: 1 }
        });
    };

    // 图片预览
    function previewImg(divId) {
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['80%', '80%'],
            skin: 'layui-layer', //没有背景色
            shadeClose: true,
            content: $('#' + divId).html()
        });
    };
</script>